import request from '@/utils/request'
import { BaseResponse } from '../base'
import type { WalletLogPageReq } from './type'

export function getBalance(): Promise<BaseResponse> {
  return request({ url: '/campus/wallet/queryBalance', method: 'get' })
}

export function queryRecord(params: WalletLogPageReq): Promise<BaseResponse> {
  return request({ url: '/campus/wallet/queryRecord', method: 'get', params })
}

export function recharge(amount: number): Promise<BaseResponse> {
  return request({ url: '/campus/wallet/recharge', method: 'put', data: { amount } })
}

export function withdraw(amount: number): Promise<BaseResponse> {
  return request({ url: '/campus/wallet/withdraw', method: 'put', data: { amount } })
}